package com.haiertvbic.tvnow.baseactivity;

import android.app.Activity;
import android.content.Context;
import android.graphics.Color;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.LinearLayout;

import com.haiertvbic.tvnow.R;
import com.haiertvbic.tvnow.util.Util;

public abstract class BaseActivity extends Activity {
	protected static final String TAG = "BaseActivity";
	private LinearLayout anim;
	Context context;
	Handler switchHandler;
	private View fView;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		float pictureWidth = getResources().getDimension(R.dimen.picture_width);// 得倒的就是像素值
		int width = (int) (pictureWidth + 0.5f);
		fView = Util.setActivityView(getWindow(), getWindowManager(), width, 0);
		fView.setBackgroundColor(Color.TRANSPARENT);

		findView();
		anim = (LinearLayout) findViewById(R.id.anim);
		startAnim();
		setDataSetup();
	}

	public abstract void setDataSetup();

	public abstract void findView();

	public void startAnim() {
		Animation inAnimation = AnimationUtils.loadAnimation(this,
				R.anim.slide_in_right);
		inAnimation.setStartOffset(100);
		anim.startAnimation(inAnimation);
	}

}
